<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true">
      <el-form-item label="">
        <el-select
          v-model="queryParams.lineId"
          placeholder="线名"
          clearable
          style="width: 140px"
        >
          <el-option
            v-for="dict in railwayNameobj"
            :key="dict.railwayName"
            :label="dict.railwayName"
            :value="dict.id"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="" class="formitemcla">
        <el-input v-model="queryParams.startingMileage" placeholder="起点里程" clearable style="width: 140px">
          <template #suffix> km </template>
        </el-input>
      </el-form-item> -->
      <!-- <el-form-item label="~">
        <el-input v-model="queryParams.destinationMileage" placeholder="终点里程" clearable style="width: 140px">
          <template #suffix> km </template>
        </el-input>
      </el-form-item> -->
      <el-form-item label="">
        <el-input
          v-model="queryParams.culvertCode"
          placeholder="涵洞编号"
          clearable
          style="width: 140px"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="getList" style="width: 90px"
          >查询</el-button
        >
        <el-button @click="resetQuery" style="width: 90px">重置</el-button>
        <el-button type="primary" @click="handleQuery" style="width: 90px"
          >导出</el-button
        >
        <el-button type="primary" @click="handleAdd" style="width: 90px"
          >新增</el-button
        >
      </el-form-item>
    </el-form>
    <!-- 表格数据 -->
    <el-table
      v-loading="loading"
      :data="railList"
      height="62vh"
      border
      @selection-change="selectiontab"
    >
      <el-table-column type="selection" label="全选" width="50" />
      <el-table-column label="序号" type="index" width="80" />
      <el-table-column label="涵洞编号" prop="culvertCode" min-width="80" />
      <el-table-column label="里程" prop="centreMileageStr" min-width="80" />
      <el-table-column label="孔跨" prop="holeSpan" min-width="80" />
      <el-table-column label="式样" prop="styleName" min-width="80" />
      <el-table-column label="上下行" prop="lineType" min-width="80" />
      <el-table-column label="延长米" prop="lengthen" min-width="80" />
      <el-table-column
        label="设计流量(m³/s)"
        prop="designDischarge"
        min-width="80"
      />
      <el-table-column label="坡度(‰)" prop="slope" min-width="80" />
      <el-table-column label="填土高度" prop="fillingHeight" min-width="80" />
      <el-table-column
        label="病害整治情况"
        prop="diseaseControlSituation"
        min-width="80"
      />
      <el-table-column
        label="涵洞结构类型"
        prop="culvertStructureType"
        min-width="80"
      />
      <el-table-column label="涵洞作用" prop="culvertEffect" min-width="80" />
      <el-table-column
        label="建成年限"
        prop="completionPeriod"
        min-width="80"
      />
      <el-table-column label="备注" prop="comment" min-width="80" />
      <el-table-column label="直接数据" min-width="110">
        <template #default="scope">
          <div class="buttontext">
            <el-button link type="primary" @click="parameter(scope.row)"
              >参数</el-button
            >
            <el-button link type="primary" @click="meansFun(scope.row)"
              >资料</el-button
            >
          </div>
        </template>
      </el-table-column>
      <el-table-column label="关联数据" min-width="210">
        <template #default="scope">
          <div class="buttontext">
            <el-button link type="primary" @click="resumeUpdate(scope.row)"
              >作业履历</el-button
            >
            <el-button link type="primary" @click="deviceProblem(scope.row)"
              >设备问题</el-button
            >
            <el-button link type="primary" @click="businessFinance(scope.row)"
              >业财</el-button
            >
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作" min-width="100">
        <template #default="scope">
          <div class="buttontext">
            <el-button link type="primary" @click="handDelete(scope.row.id)"
              >删除</el-button
            >
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- 添加或修改用户配置对话框 -->
    <el-dialog :title="title" v-model="open" width="1300px" append-to-body>
      <el-form
        ref="userRef"
        :model="form"
        :rules="rules"
        label-width="80px"
        :inline="true"
      >
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">位置</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="单位名称" prop="unitId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.unitId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in unitNameobj"
                  :key="dict.id"
                  :label="dict.unitName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="线名" prop="railwayId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.railwayId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railwayNameobj"
                  :key="dict.id"
                  :label="dict.railwayName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上下行" prop="lineTypeId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.lineTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in progressTypeobj"
                  :key="dict.id"
                  :label="dict.progressType"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="里程" prop="centreMileage">
              <el-input
                type="number"
                v-model="form.centreMileage"
                placeholder="请输入里程"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵洞编号" prop="culvertCode">
              <el-input
                v-model="form.culvertCode"
                placeholder="请输入涵洞编号"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵洞名称" prop="culvertName">
              <el-input
                v-model="form.culvertName"
                placeholder="请输入涵洞名称"
              />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-form-item label="起点里程" prop="startingMileage">
              <el-input type="number" v-model="form.startingMileage" placeholder="请输入起点里程" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="终点里程" prop="destinationMileage">
              <el-input type="number" v-model="form.destinationMileage" placeholder="请输入终点里程" />
            </el-form-item>
          </el-col> -->
        </el-row>
        <el-row> </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">特性</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="轨距类型" prop="gaugeTypeId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.gaugeTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in gaugeTypeIdList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="全长" prop="overallLength">
              <el-input
                type="number"
                v-model="form.overallLength"
                placeholder="请输入全长"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="图号" prop="figureNumber">
              <el-input v-model="form.figureNumber" placeholder="请输入图号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="涵洞限高" prop="culvertHeightPermitted">
              <el-input
                type="number"
                v-model="form.culvertHeightPermitted"
                placeholder="请输入涵洞限高"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="延长米" prop="lengthen">
              <el-input
                type="number"
                v-model="form.lengthen"
                placeholder="请输入延长米"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设计流量(m³/s)" prop="designDischarge">
              <el-input
                v-model="form.designDischarge"
                placeholder="请输入设计流量"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="设备结构" prop="facilityStructure">
              <el-input
                v-model="form.facilityStructure"
                placeholder="请输入设备结构"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="结构尺寸" prop="structureSize">
              <el-input
                v-model="form.structureSize"
                placeholder="请输入结构尺寸"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开工日期" prop="commencementDate">
              <el-date-picker
                style="width: 180px"
                format="YYYY/MM/DD"
                value-format="YYYY/MM/DD"
                v-model="form.commencementDate"
                type="datetime"
                placeholder="请选择开工日期"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="竣工日期" prop="completedDate">
              <el-date-picker
                style="width: 180px"
                format="YYYY/MM/DD"
                value-format="YYYY/MM/DD"
                v-model="form.completedDate"
                type="datetime"
                placeholder="请选择竣工日期"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="建成年限" prop="completionPeriod">
              <el-date-picker
                style="width: 180px"
                format="YYYY/MM/DD"
                value-format="YYYY/MM/DD"
                v-model="form.completionPeriod"
                type="datetime"
                placeholder="请选择建成年限"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵洞结构类型" prop="culvertStructureTypeId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.culvertStructureTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in culvertStructureTypeIdList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="按构造形式分类" prop="structureShapeClassify">
              <el-input
                v-model="form.structureShapeClassify"
                placeholder="请输入桥长"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="按洞口形式分类" prop="holeShapeClassify">
              <el-input
                v-model="form.holeShapeClassify"
                placeholder="请输入桥长"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="按水利性能分类" prop="waterShapeClassify">
              <el-input
                v-model="form.waterShapeClassify"
                placeholder="请输入按水利性能分类"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="推定强度/Mpa" prop="presumptionStrength">
              <el-input
                v-model="form.presumptionStrength"
                placeholder="请输入推定强度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="设计强度" prop="designStrength">
              <el-input
                v-model="form.designStrength"
                placeholder="请输入设计强度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵洞孔径" prop="culvertAperture">
              <el-input
                type="number"
                v-model="form.culvertAperture"
                placeholder="请输入涵洞孔径"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="涵洞净高" prop="culvertHeight">
              <el-input
                type="number"
                v-model="form.culvertHeight"
                placeholder="请输入涵洞净高"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="盖板宽度" prop="coverPlateWidth">
              <el-input
                type="number"
                v-model="form.coverPlateWidth"
                placeholder="请输入盖板宽度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="盖板长度" prop="coverPlateLength">
              <el-input
                type="number"
                v-model="form.coverPlateLength"
                placeholder="请输入盖板长度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="盖板高度" prop="coverPlateHeight">
              <el-input
                type="number"
                v-model="form.coverPlateHeight"
                placeholder="请输入盖板高度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="填土高度" prop="fillingHeight">
              <el-input
                type="number"
                v-model="form.fillingHeight"
                placeholder="请输入填土高度"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="坡度(‰)" prop="slope">
              <el-input
                type="number"
                v-model="form.slope"
                placeholder="请输入坡度（‰）"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="涵台断面尺寸" prop="culvertFractureSurface">
              <el-input
                v-model="form.culvertFractureSurface"
                placeholder="请输入涵台断面尺寸"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵台竖直度" prop="culvertVertical">
              <el-input
                type="number"
                v-model="form.culvertVertical"
                placeholder="请输入涵台竖直度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵台顶面高程" prop="culvertTopSurface">
              <el-input
                type="number"
                v-model="form.culvertTopSurface"
                placeholder="请输入涵台顶面高程"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="流水面高程" prop="nagashiSomenHeight">
              <el-input
                type="number"
                v-model="form.nagashiSomenHeight"
                placeholder="请输入流水面高程"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵底铺砌厚度" prop="culvertPaveThickness">
              <el-input
                v-model="form.culvertPaveThickness"
                placeholder="请输入涵底铺砌厚度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="一字墙平面位置" prop="wallPlaneLocation">
              <el-input
                v-model="form.wallPlaneLocation"
                placeholder="请输入一字墙平面位置"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="一字墙顶面高程" prop="wallTopSurfaceHeight">
              <el-input
                type="number"
                v-model="form.wallTopSurfaceHeight"
                placeholder="请输入一字墙顶面高程"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="一字墙底面高程" prop="wallUndersideHeight">
              <el-input
                type="number"
                v-model="form.wallUndersideHeight"
                placeholder="请输入一字墙底面高程"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="一字墙竖直度" prop="wallVertical">
              <el-input
                type="number"
                v-model="form.wallVertical"
                placeholder="请输入一字墙竖直度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="一字墙断面尺寸" prop="wallFractureSurface">
              <el-input
                v-model="form.wallFractureSurface"
                placeholder="请输入一字墙断面尺寸"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="基础砌体平面尺寸" prop="basicsPlaneSize">
              <el-input
                v-model="form.basicsPlaneSize"
                placeholder="请输入基础砌体平面尺寸"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="基础砌体顶面高程"
              prop="basicsTopSurfaceHeight"
            >
              <el-input
                type="number"
                v-model="form.basicsTopSurfaceHeight"
                placeholder="请输入基础砌体顶面高程"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="基础砌体基底高程" prop="basicsBaseHeight">
              <el-input
                type="number"
                v-model="form.basicsBaseHeight"
                placeholder="请输入基础砌体基底高程"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="垫层宽度" prop="cushionPlyWidth">
              <el-input
                type="number"
                v-model="form.cushionPlyWidth"
                placeholder="请输入垫层宽度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="垫层厚度" prop="cushionPlyThickness">
              <el-input
                type="number"
                v-model="form.cushionPlyThickness"
                placeholder="请输入垫层厚度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="孔跨" prop="holeSpan">
              <el-input v-model="form.holeSpan" placeholder="请输入孔跨" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="式样" prop="styleId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.styleId"
                placeholder="请选择样式"
              >
                <el-option
                  v-for="dict in styleList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="轴线偏位" prop="axisDeviation">
              <el-input
                v-model="form.axisDeviation"
                placeholder="请输入轴线偏位"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="孔数" prop="holeNum">
              <el-input v-model="form.holeNum" placeholder="请输入孔数" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="顶板拱圈材质" prop="roofArchRingTextureId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.roofArchRingTextureId"
                placeholder="请选择样式"
              >
                <el-option
                  v-for="dict in roofArchRingTextureIdList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="边墙材质" prop="flankWallTextureId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.flankWallTextureId"
                placeholder="请选择样式"
              >
                <el-option
                  v-for="dict in flankWallTextureIdList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="基础式样" prop="basicsStyleId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="form.basicsStyleId"
                placeholder="请选择样式"
              >
                <el-option
                  v-for="dict in basicsStyleIdList"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="基础深度" prop="basicsDepth">
              <el-input
                v-model="form.basicsDepth"
                placeholder="请输入基础深度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="基础地质" prop="basicsGeology">
              <el-input
                v-model="form.basicsGeology"
                placeholder="请输入基础地质"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="与线路交叉角度" prop="crossAngle">
              <el-input
                v-model="form.crossAngle"
                placeholder="请输入与线路交叉角度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="涵洞作用" prop="culvertEffect">
              <el-input
                v-model="form.culvertEffect"
                placeholder="请输入涵洞作用"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">静态检测</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepth1">
              <el-input
                v-model="form.betonCarbonizeDepth1"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepth2">
              <el-input
                v-model="form.betonCarbonizeDepth2"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepth3">
              <el-input
                v-model="form.betonCarbonizeDepth3"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepth4">
              <el-input
                v-model="form.betonCarbonizeDepth4"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepth5">
              <el-input
                v-model="form.betonCarbonizeDepth5"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="混凝土碳化深度" prop="betonCarbonizeDepthAvg">
              <el-input
                v-model="form.betonCarbonizeDepthAvg"
                placeholder="请输入混凝土碳化深度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item
              label="钢筋保护层厚度-最小值"
              prop="rebarMaskantThicknessMin"
            >
              <el-input
                v-model="form.rebarMaskantThicknessMin"
                placeholder="请输入钢筋保护层厚度-最小值"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="钢筋保护层厚度-最大值"
              prop="rebarMaskantThicknessMax"
            >
              <el-input
                v-model="form.rebarMaskantThicknessMax"
                placeholder="请输入钢筋保护层厚度-最大值"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="钢筋保护层厚度-平均值"
              prop="rebarMaskantThicknessAvg"
            >
              <el-input
                v-model="form.rebarMaskantThicknessAvg"
                placeholder="请输入钢筋保护层厚度-平均值"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item
              label="钢筋保护层厚度-合格率"
              prop="rebarMaskantThicknessEligible"
            >
              <el-input
                v-model="form.rebarMaskantThicknessEligible"
                placeholder="请输入钢筋保护层厚度-合格率"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">健康值</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="健康值" prop="healthIndex">
              <el-input
                v-model="form.healthIndex"
                placeholder="请输入健康值"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="隐患等级" prop="hiddenDangerLevel">
              <el-input
                v-model="form.hiddenDangerLevel"
                placeholder="请输入隐患等级"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="存在问题" prop="existingProblem">
              <el-input
                v-model="form.existingProblem"
                placeholder="请输入存在问题"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="病害整治情况" prop="diseaseControlSituation">
              <el-input
                v-model="form.diseaseControlSituation"
                placeholder="请输入病害整治情况"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="病害整治年份" prop="yearOfDiseaseControl">
              <el-input
                v-model="form.yearOfDiseaseControl"
                placeholder="请输入病害整治年份"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="设备使用频率" prop="equipmentUsageFrequency">
              <el-input
                v-model="form.equipmentUsageFrequency"
                placeholder="请输入设备使用频率"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item
              label="设备综合效率(OEE)"
              prop="overallEquipmentEfficiency"
            >
              <el-input
                v-model="form.overallEquipmentEfficiency"
                placeholder="请输入设备综合效率(OEE)"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item
              label="平均无故障工作时间(MTTF)"
              prop="meanTimeToFailure"
            >
              <el-input
                v-model="form.meanTimeToFailure"
                placeholder="请输入平均无故障工作时间(MTTF)"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="平均修复时间(MTTR)" prop="meanTimeToRepair">
              <el-input
                v-model="form.meanTimeToRepair"
                placeholder="请输入平均修复时间(MTTR)"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">管理</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="8">
            <el-form-item label="区段" prop="sector">
              <el-input
                v-model="form.sector"
                placeholder="请输入区段"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="工区" prop="workArea">
              <el-input
                v-model="form.workArea"
                placeholder="请输入工区"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="人员" prop="personnel">
              <el-input v-model="form.personnel" placeholder="请输入人员" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="包保责任人" prop="personInCharge">
              <el-input
                v-model="form.personInCharge"
                placeholder="请输入包保责任人"
              /> </el-form-item
          ></el-col>
          <el-col :span="8">
            <el-form-item label="备注" prop="comment">
              <el-input
                v-model="form.comment"
                type="textarea"
                placeholder="请输入内容"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="divflex" v-if="parameterShow">
        <span class="leftx"></span>
        <span class="mainz">修改历史</span>
        <span class="rightx"></span>
      </div>
      <el-table
        :data="allBridgeChangeData"
        border
        height="300px"
        v-if="parameterShow"
      >
        <el-table-column label="序号" type="index" width="80" />
        <el-table-column
          label="指标名"
          prop="property"
          min-width="80"
        ></el-table-column>
        <el-table-column
          label="变更前指标值"
          prop="oldValue"
          min-width="80"
        ></el-table-column>
        <el-table-column
          label="变更后指标值"
          prop="newValue"
          min-width="80"
        ></el-table-column>
        <el-table-column
          label="变更时间"
          prop="createTime"
          min-width="80"
        ></el-table-column>
        <el-table-column
          label="操作用户名"
          prop="user"
          min-width="80"
        ></el-table-column>
      </el-table>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog
      draggable
      title="资料"
      v-model="meansopen"
      width="1300px"
      append-to-body
      @close="closefun"
    >
      <means :forma="formam" parentName="全桥" v-if="meansopen"></means>
    </el-dialog>
  </div>
</template>

<script setup name="Bridge">
import {
  selectManCulvertFacilityList,
  addinsertManCulvertFacility,
  editManCulvertFacility,
  deleteManCulvertFacilityById,
  selectManCulvertFacilityById,
  getselectManCulvertEditRecordListList,
  getSelectListApi,
} from "@/api/main/bridge.js";
import {
  selectManBasicUnitListapi,
  selectManBasicRailwayListapi,
  selectManBasicprogressTypeListapi,
} from "@/api/main/api.js";
import { useContent } from "@/mixin/index.js";
const {
  meansopen,
  meansFun,
  formam,
  closefun,
  resumeUpdate,
  deviceProblem,
  businessFinance,
} = useContent();
import means from "@/components/railmodle/means.vue";
import { reactive, ref, toRefs } from "vue";
const { proxy } = getCurrentInstance();
const title = ref("新增");
const loading = ref(true);
const open = ref(false);
const equipmentproblemShow = ref(false);
const businessFinanceShow = ref(false);

const parameterShow = ref(false);

defineExpose({ getList });
const emit = defineEmits(["parentCount"]);

const data = reactive({
  faultForm: {
    lineId: "",
    tabledata: [],
  },
  railList: [],
  selecttabList: [],
  //单位名称列表数据
  unitNameobj: [],
  //线名数据列表
  railwayNameobj: [],
  //上下行数据列表
  progressTypeobj: [],
  // 式样
  styleList: [],
  // 轨距类型
  gaugeTypeIdList: [],
  // 涵洞结构类型
  culvertStructureTypeIdList: [],
  // 顶板拱圈材质
  roofArchRingTextureIdList: [],
  // 边墙材质
  flankWallTextureIdList: [],
  // 基础式样
  basicsStyleIdList: [],
  form: {},
  queryParams: {
    pageNum: "1",
    pageSize: "10",
    lineId: "",
    startingMileage: "",
    destinationMileage: "",
    culvertCode: "",
  },
  railList: [],
  //单位名称列表数据
  unitNameobj: [],
  //线名数据列表
  railwayNameobj: [],
  queryParams: {
    pageNum: "1",
    pageSize: "10",
    lineName: "",
    startingMileage: "",
    destinationMileage: "",
    bridgeId: "",
  },
  rules: {
    unitId: [
      {
        required: true,
        message: "单位名称不能为空",
        trigger: ["blur", "change"],
      },
    ],
    railwayId: [
      { required: true, message: "线名不能为空", trigger: ["blur", "change"] },
    ],
    progressTypeId: [
      {
        required: true,
        message: "上下行不能为空",
        trigger: ["blur", "change"],
      },
    ],
    centreMileage: [
      { required: true, message: "里程不能为空", trigger: ["blur", "change"] },
    ],
    // startingMileage: [{ required: true, message: "起点里程不能为空", trigger: ["blur", "change"] }],
    // destinationMileage: [{ required: true, message: "终点里程不能为空", trigger: ["blur", "change"] }],
    culvertCode: [
      {
        required: true,
        message: "涵洞编号不能为空",
        trigger: ["blur", "change"],
      },
    ],
    overallLength: [
      { required: true, message: "全长不能为空", trigger: ["blur", "change"] },
    ],
    culvertHeightPermitted: [
      {
        required: true,
        message: "涵洞限高不能为空",
        trigger: ["blur", "change"],
      },
    ],
  },
  allBridgeChangeData: [],
  economyTableData: [],
  ledgerTabledata: [],
});

const {
  faultForm,
  queryParams,
  railList,
  selecttabList,
  form,
  rules,
  unitNameobj,
  railwayNameobj,
  progressTypeobj,
  styleList,
  gaugeTypeIdList,
  culvertStructureTypeIdList,
  roofArchRingTextureIdList,
  flankWallTextureIdList,
  basicsStyleIdList,
  allBridgeChangeData,
  economyTableData,
  ledgerTabledata,
} = toRefs(data);

const pageNumparent = ref(undefined);
const pageSizeparent = ref(undefined);

function init() {
  getLineDataList();
  getUnitDataList();
  getxbData();
  getData();
  getList();
}
init();
/** 查询列表 */

function getList(pageNum, pageSize) {
  loading.value = true;
  if (pageNum != undefined || pageSize != undefined) {
    pageNumparent.value = pageNum;
    pageSizeparent.value = pageSize;
    queryParams.value.pageNum = pageNum == undefined ? 1 : pageNum;
    queryParams.value.pageSize = pageSize == undefined ? 10 : pageSize;
  } else {
    queryParams.value.pageNum =
      pageNumparent.value == undefined ? "1" : pageNumparent.value;
    queryParams.value.pageSize =
      pageSizeparent.value == undefined ? "10" : pageSizeparent.value;
  }
  selectManCulvertFacilityList({
    pageNum: queryParams.value.pageNum,
    pageSize: queryParams.value.pageSize,
    railwayId: queryParams.value.lineId,
    startingMileage: queryParams.value.startingMileage,
    destinationMileage: queryParams.value.destinationMileage,
    culvertCode: queryParams.value.culvertCode,
  }).then((res) => {
    if (res.code == 200) {
      data.railList = res.data;
    }
    loading.value = false;
    emit("parentCount", res.count);
  });
}
/** 查询基础数据-单位数据列表 */
function getUnitDataList() {
  selectManBasicUnitListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      unitNameobj.value = res.data;
      console.log(unitNameobj.value);
    }
  });
}
/** 查询基础数据-线名数据列表 */
function getLineDataList() {
  selectManBasicRailwayListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      railwayNameobj.value = res.data;
      console.log(railwayNameobj.value);
    }
  });
}
/** 查询基础数据-上下行数据列表 */
function getxbData() {
  selectManBasicprogressTypeListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      progressTypeobj.value = res.data;
      console.log(progressTypeobj.value);
    }
  });
}
function getData() {
  getSelectListApi({ propertyType: "轨距类型" }).then((res) => {
    if (res.code == 200) {
      gaugeTypeIdList.value = res.data;
    }
  });
  getSelectListApi({ propertyType: "涵洞结构类型" }).then((res) => {
    if (res.code == 200) {
      culvertStructureTypeIdList.value = res.data;
    }
  });
  getSelectListApi({ propertyType: "式样" }).then((res) => {
    if (res.code == 200) {
      styleList.value = res.data;
    }
  });
  getSelectListApi({ propertyType: "顶板拱圈材质" }).then((res) => {
    if (res.code == 200) {
      roofArchRingTextureIdList.value = res.data;
    }
  });
  getSelectListApi({ propertyType: "边墙材质" }).then((res) => {
    if (res.code == 200) {
      flankWallTextureIdList.value = res.data;
    }
  });
  getSelectListApi({ propertyType: "基础式样" }).then((res) => {
    if (res.code == 200) {
      basicsStyleIdList.value = res.data;
    }
  });
}
/* 删除单行数据 */
function handDelete(row) {
  deleteManCulvertFacilityById({ id: row }).then((res) => {
    if (res.code == 200) {
      proxy.$modal.msgSuccess("删除成功");
      getList();
    }
  });
}

/** 重置操作表单 */
function reset() {
  form.value = {
    id: "",
    unitId: "",
    railwayName: "",
    railwayId: "",
    centreMileage: "",
    startingMileage: "",
    destinationMileage: "",
    culvertCode: "",
    culvertName: "",
    gaugeTypeId: "",
    overallLength: "",
    figureNumber: "",
    culvertHeightPermitted: "",
    lengthen: "",
    designDischarge: "",
    culvertEffect: "",
    facilityStructure: "",
    structureSize: "",
    commencementDate: "",
    completedDate: "",
    completionPeriod: "",
    culvertStructureTypeId: "",
    structureShapeClassify: "",
    holeShapeClassify: "",
    waterShapeClassify: "",
    presumptionStrength: "",
    designStrength: "",
    culvertAperture: "",
    culvertHeight: "",
    coverPlateWidth: "",
    coverPlateLength: "",
    coverPlateHeight: "",
    fillingHeight: "",
    slope: "",
    culvertFractureSurface: "",
    culvertVertical: "",
    culvertTopSurface: "",
    nagashiSomenHeight: "",
    culvertPaveThickness: "",
    wallPlaneLocation: "",
    wallTopSurfaceHeight: "",
    wallUndersideHeight: "",
    wallVertical: "",
    wallFractureSurface: "",
    basicsPlaneSize: "",
    basicsTopSurfaceHeight: "",
    basicsBaseHeight: "",
    cushionPlyWidth: "",
    cushionPlyThickness: "",
    holeSpan: "",
    styleId: "",
    axisDeviation: "",
    holeNum: "",
    roofArchRingTextureId: "",
    flankWallTextureId: "",
    basicsStyleId: "",
    basicsDepth: "",
    basicsGeology: "",
    crossAngle: "",
    betonCarbonizeDepth1: "",
    betonCarbonizeDepth2: "",
    betonCarbonizeDepth3: "",
    betonCarbonizeDepth4: "",
    betonCarbonizeDepth5: "",
    betonCarbonizeDepthAvg: "",
    rebarMaskantThicknessMin: "",
    rebarMaskantThicknessMax: "",
    rebarMaskantThicknessAvg: "",
    rebarMaskantThicknessEligible: "",
    healthIndex: "",
    hiddenDangerLevel: "",
    existingProblem: "",
    diseaseControlSituation: "",
    yearOfDiseaseControl: "",
    equipmentUsageFrequency: "",
    overallEquipmentEfficiency: "",
    meanTimeToFailure: "",
    meanTimeToRepair: "",
    sector: "",
    workArea: "",
    personnel: "",
    personInCharge: "",
    comment: "",
    longitude: "",
    latitude: "",
    hasDelete: "",
    createTime: "",
  };
  proxy.resetForm("userRef");
}
/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  title.value = "新增";
  parameterShow.value = false;
}
/** 提交按钮 */
function submitForm() {
  proxy.$refs["userRef"].validate((valid) => {
    if (valid) {
      //单位名称列表数据
      unitNameobj.value.forEach((item) => {
        if (form.value.unitId == item.id) {
          form.value.unitName = item.unitName;
        }
      });
      //线名数据列表
      railwayNameobj.value.forEach((item) => {
        if (form.value.railwayId == item.id) {
          form.value.railwayName = item.railwayName;
        }
      });
      //上下行数据列表
      progressTypeobj.value.forEach((item) => {
        if (form.value.lineTypeId == item.id) {
          form.value.lineType = item.progressType;
        }
      });
      // 式样
      styleList.value.forEach((item) => {
        if (form.value.styleId == item.id) {
          form.value.style = item.progressType;
        }
      });
      // 轨距类型
      gaugeTypeIdList.value.forEach((item) => {
        if (form.value.gaugeTypeId == item.id) {
          form.value.gaugeType = item.progressType;
        }
      });
      // 涵洞结构类型
      culvertStructureTypeIdList.value.forEach((item) => {
        if (form.value.culvertStructureTypeId == item.id) {
          form.value.culvertStructureType = item.progressType;
        }
      });
      // 顶板拱圈材质
      roofArchRingTextureIdList.value.forEach((item) => {
        if (form.value.roofArchRingTextureId == item.id) {
          form.value.roofArchRingTexture = item.progressType;
        }
      });
      // 边墙材质
      flankWallTextureIdList.value.forEach((item) => {
        if (form.value.flankWallTextureId == item.id) {
          form.value.flankWallTexture = item.progressType;
        }
      });
      // 基础式样
      basicsStyleIdList.value.forEach((item) => {
        if (form.value.basicsStyleId == item.id) {
          form.value.basicsStyle = item.progressType;
        }
      });
      // 里程四舍五入
      form.value.startingMileage =
        Math.round(form.value.startingMileage * 1000000) / 1000000;
      form.value.destinationMileage =
        Math.round(form.value.destinationMileage * 1000000) / 1000000;
      form.value.centreMileage =
        Math.round(form.value.centreMileage * 1000000) / 1000000;
      if (form.value.startingMileage > form.value.destinationMileage) {
        proxy.$modal.msgError(`起始里程应该小于等于终点里程`);
        return false;
      }
      if (form.value.id) {
        editManCulvertFacility(form.value).then((res) => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        });
      } else {
        addinsertManCulvertFacility(form.value).then((res) => {
          proxy.$modal.msgSuccess("新增成功");
          open.value = false;
          getList();
        });
      }
    }
  });
}
/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}
function selectiontab(row) {
  selecttabList.value = row;
}
// 导出
function handleQuery() {
  const arrid = [];
  for (let i = 0; i < selecttabList.value.length; i++) {
    arrid.push(selecttabList.value[i].id);
  }
  proxy.download1(
    "/facility-manage/facility/exportExcel",
    arrid,
    `涵${new Date().getTime()}.xlsx`
  );
}
//重置
function resetQuery() {
  queryParams.value = {
    lineId: "",
    startingMileage: "",
    destinationMileage: "",
    culvertCode: "",
  };
  getList();
}
// 查看参数
function parameter(rows) {
  selectManCulvertFacilityById({
    id: rows.id,
  }).then((res) => {
    form.value = res.data;
    getselectManCulvertEditRecordListList({
      culvertId: rows.id,
    }).then((res1) => {
      allBridgeChangeData.value = res1.data;
      title.value = "参数";
      open.value = true;
      parameterShow.value = true;
    });
  });
}
// // 设备
// function equipmentproblem() {
//   equipmentproblemShow.value = true;
// }
// // 业财
// function businessFinance() {
//   businessFinanceShow.value = true;
// }
</script>

<style scoped lang="scss">
.divflex {
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .leftx {
    width: 45%;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #e8e8e8;
    margin-top: 3px;
  }

  .mainz {
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 24px;
  }

  .rightx {
    width: 45%;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #e8e8e8;
    margin-top: 3px;
  }
}

.buttontext {
  .el-button:hover {
    // text-decoration: line-through !important;
  }
}

.el-form--inline .el-form-item.formitemcla {
  margin-right: 5px !important;
}
</style>
